home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1990-1992 by Michael Davidson.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation.
- *
- * This software is provided "as is" without express or implied warranty.
- */
-
- /*
- * ati.c - support routines for ATI VGA Wonder
- */
-
- #include "vdev.h"
- #include "svga.h"
-
- /*
- * table of video modes supported for ATI VGA Wonder
- */
- #define GRAPHICS (SVGA_MODE_SUPPORTED | SVGA_GRAPHICS_MODE)
- #define TEXT (SVGA_MODE_SUPPORTED | SVGA_TEXT_MODE)
-
- static struct svga_mode_info ati_modes[] =
- {
- { 800, 600, 8, 0x63, GRAPHICS },
- { 640, 480, 8, 0x62, GRAPHICS },
- { 640, 400, 8, 0x61, GRAPHICS },
- { 320, 200, 8, 0x13, GRAPHICS },
- { 80, 25, 0, 0x03, TEXT },
- { 0, 0, 0, 0x00, 0 }
- };
-
- /*
- * ATI VGA Wonder extended register
- */
- static unsigned ati_reg;
-
- #define ATI_IDX (ati_reg)
- #define ATI_DAT (ati_reg + 1)
-
- static void ati_bank_switch();
- static int ati_present();
-
- /*ARGSUSED*/
- int
- ati_init(
- char *name,
- struct vdev *v
- )
- {
- int r;
-
- if (! (r = ati_present()))
- return -1;
-
- svga_setup(v, ati_modes, ati_bank_switch);
-
- v->v_name = "ATI VGA Wonder";
-
- ati_reg = VideoBiosAddress[0x10] | (VideoBiosAddress[0x11] << 8);
- V86IOEnable(ati_reg, 2);
-
- return 0;
- }
-
- int
- ati_probe()
- {
- return ati_present();
- }
-
- void
- ati_io_enable()
- {
- ati_reg = VideoBiosAddress[0x10] | (VideoBiosAddress[0x11] << 8);
- V86IOEnable(ati_reg, 2);
- V86IOEnable(0x56ee, 2);
- }
-
- static int
- ati_present()
- {
- return (memcmp(VideoBiosAddress + 0x31, "761295520", 9) == 0);
- }
-
- /*
- * ati_bank_switch()
- */
- static void
- ati_bank_switch(
- int x
- )
- {
- x &= 7;
- x <<= 1;
-
- outb(ATI_IDX, 0xb2);
- x |= (inb(ATI_DAT) & 0xe1);
- outb(ATI_IDX, 0xb2);
- outb(ATI_DAT, x);
- }
-
-